Skip to content

fix(adapters): route azure-foundry through apiBase without /openai/deployments/{deployment} (#13114) - #13161

Open
santhiprakash wants to merge 1 commit into
continuedev:mainfrom
santhiprakash:fix/13114-azure-foundry-routing
Open

fix(adapters): route azure-foundry through apiBase without /openai/deployments/{deployment} (#13114)#13161
santhiprakash wants to merge 1 commit into
continuedev:mainfrom
santhiprakash:fix/13114-azure-foundry-routing

Conversation

@santhiprakash

Copy link
Copy Markdown

Description

AzureApi._getAzureBaseURL previously forced every provider: azure request through the legacy Azure OpenAI Service URL shape (/openai/deployments/{deployment}?api-version=...) regardless of env.apiType. That 404s on Azure AI Foundry (a.k.a. Microsoft Foundry) endpoints, which expose an OpenAI-compatible /openai/v1 path supplied by the user in apiBase.

The AzureConfigSchema in packages/openai-adapters/src/types.ts already declares apiType: "azure-foundry" as a valid value, but the AzureApi implementation never branched for it. This PR adds the branch:

  • When env.apiType === "azure-foundry", return the apiBase (with trailing slash trimmed, search params extracted into defaultQuery) without appending /openai/deployments/{deployment}.
  • Skip the env.deployment / env.apiVersion requirements for foundry (those are Azure OpenAI Service-only).
  • azure-openai / azure paths keep their existing behavior.

Reproduction (from the issue)

name: Main Config
version: 1.0.0
schema: v1
models:
  - name: gpt-5.3-codex
    provider: azure
    model: gpt-5.3-codex
    apiKey: YOUR_API_KEY
    apiBase: https://<your-resource>.services.ai.azure.com/openai/v1

Before: AzureApi rewrites apiBase to https://<your-resource>.services.ai.azure.com/openai/v1/openai/deployments/<deployment> and the Foundry endpoint returns 404.
After: apiBase is used as-is; the request reaches the Foundry OpenAI-compatible routing path.

Tests

Added 2 regression tests in packages/openai-adapters/src/test/main.test.ts:

  • should configure Azure AI Foundry client without appending /openai/deployments/{deployment} — verifies the baseURL is the user-supplied apiBase.
  • should not require env.deployment or env.apiVersion for Azure AI Foundry — verifies no deployment / apiVersion is required for apiType: "azure-foundry".

The fix was verified by extracting _getAzureBaseURL into a standalone Node script and running 6 cases (3 legacy azure-openai + 3 foundry) against hand-computed expected baseURLs (all pass). I could not run the vitest suite in this environment (no node_modules at the workspace root); the upstream vitest suite should be re-run by the maintainer.

Checklist

I have read the CLA Document and I hereby sign the CLA

🤖 Generated with Hermes Agent

@santhiprakash
santhiprakash requested a review from a team as a code owner August 18, 2026 20:31
@santhiprakash
santhiprakash requested review from sestinj and removed request for a team August 18, 2026 20:31
…ployments/{deployment} (continuedev#13114)

AzureApi._getAzureBaseURL previously forced every 'provider: azure' request
through the legacy Azure OpenAI Service URL shape
(/openai/deployments/{deployment}?api-version=...). That 404s on Azure AI
Foundry (a.k.a. Microsoft Foundry) endpoints, which expose an OpenAI-
compatible /openai/v1 path supplied by the user in apiBase.

Add an apiType === 'azure-foundry' branch that returns the apiBase as-is,
and skip the deployment/apiVersion guards for it. The existing
'azure-openai' / 'azure' branches keep their existing behavior, including
the deployment/apiVersion requirements.

Adds 2 regression tests in main.test.ts:
- foundry apiBase round-trips without path manipulation
- foundry construction does not throw without env.deployment / env.apiVersion

Verified by extracting _getAzureBaseURL into a standalone Node script and
running 6 cases (3 legacy azure-openai + 3 foundry) against hand-computed
expected baseURLs (all pass).
@santhiprakash
santhiprakash force-pushed the fix/13114-azure-foundry-routing branch from f81f16a to d37b5b8 Compare August 21, 2026 03:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant